package com.xlabs.client;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.xlabs.client.DTO.TransferDTO;

/**
 * TimedCommentServiceAsync interface.
 */
public interface CommentingServiceAsync {

    /**
     * Posts comment for a video.
     *
     * @param comment        comment text.
     * @param time           time of comment.
     * @param currentVideoId video id.
     */
    void postQuestion(String comment, int time, String currentVideoId, AsyncCallback async);

    /**
     * Gets all comments for the given video that were posted interval seconds from the given time. 
     * @param videoId video id.
     * @param time the time for which the questions will be extracted. 
     * @param interval half of the length of the interval for which the questions will be extracted.
     * @param async callback.
     */
    void getQuestionsInSymmetricTimeInterval(String videoId, int time, int interval, AsyncCallback async);

    /**
     * Posts a reply for a question.
     *
     * @param reply       reply.
     * @param questionKey question key.
     * @return updated comments.
     */
    void postReply(String reply, String questionKey, AsyncCallback async);

    /**
     * Gets the conversation related to the question given.
     *
     * @param questionEncodedKey question's key.
     * @return conversation.
     */
    void getConversation(String questionEncodedKey, AsyncCallback async);

    /**
     * Posts an inner reply for another reply in conversation.
     *
     * @param reply              reply.
     * @param parentReplyKey     question key.
     * @param questionEncodedKey corresponding question's encoded key
     */
    void posInnertReply(String reply, String parentReplyKey, String questionEncodedKey, AsyncCallback async);

	/**
	 * Gets questions asked in the given time range.
	 * @param videoId video id.
	 * @param startTimeIndex start time 
	 * @param endTimeIndex end time.
	 * @param direction specifies the direction of query.  
	 * @param pageSize how many questions to return. 
	 * @param asyncCallBack callback method.
	 */
    void getPagedQuestionsWithStartTimeInInterval(
			String videoId, 
			String startTimeIndex,
			String endTimeIndex,
			int direction,
			int pageSize,
			AsyncCallback<TransferDTO> asyncCallBack);
    
	/**
	 * Gets questions asked around the given time.
	 * @param videoId video id.
	 * @param time input time.
	 * @param pageSize how many questions to return. 
	 * @param asyncCallBack callback method.
	 */
    void getPagedQuestionsWithStartTimeAroundTime(
			String videoId, 
			int time,
			int pageSize,
			AsyncCallback<TransferDTO> asyncCallBack);
}
